<?php

namespace app\backend\validate;
use app\common\RootValidate;

class AccountValidate extends RootValidate
{
    protected $rule = [
        'id' => 'require',
        'username' => 'require|length:2,50',
        'password' => 'require',
        'email' => 'require|email',
        'emailPwd' => 'require',
    ];

    protected $message = [
        'id.require' => '无效的账号',
        'username.require' => '请输入账号名称',
        'username.length' => '账号名称字符长度应在2~50之间',
        'password.require' => '请输入账号密码',
        'email.require' => '请输入电子邮箱',
        'email.email' => '无效的电子邮箱',
        'emailPwd.require' => '请输入邮箱密码'
    ];

    protected $scene = [
        'add' => ['username', 'password', 'email', 'emailPwd'],
        'edit' => ['id', 'username', 'password'],
    ];
}